<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/30
 * Time: 16:14
 */

namespace App\LogicService;

use App\LogicService\Contracts\OphthalmologyFundusChangeLogicContract;
use App\Models\OphthalmologyFundusChange;


class OphthalmologyFundusChangeLogic extends BaseLogic implements OphthalmologyFundusChangeLogicContract
{
    public function update($record_id, $value)
    {
        $ophthalmologyFundusChange = OphthalmologyFundusChange::firstOrCreate(['record_id' => $record_id, 'project_type' => $value['project_type']]);
        $ophthalmologyFundusChange->left_quadrant = $value['left_quadrant'];
        $ophthalmologyFundusChange->left_pathological_changes = $value['left_pathological_changes'];
        $ophthalmologyFundusChange->right_quadrant = $value['right_quadrant'];
        $ophthalmologyFundusChange->right_pathological_changes = $value['right_pathological_changes'];
        $ophthalmologyFundusChange->status = $value['status'];
        $ophthalmologyFundusChange->save();

        return $ophthalmologyFundusChange;
    }

    public function getList($record_id)
    {
        $ophthalmologyFundusChange = OphthalmologyFundusChange::where('record_id', $record_id)
            ->get()
            ->toArray();
        return $ophthalmologyFundusChange;
    }
}